package com.entmanage.base.collegeco.controller;

import com.entmanage.base.collegeco.domain.CollegecoIntern;
import com.entmanage.base.collegeco.service.ICollegecoInternService;
import io.swagger.annotations.Api;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.entmanage.common.annotation.Log;
import com.entmanage.common.core.controller.BaseController;
import com.entmanage.common.core.domain.AjaxResult;
import com.entmanage.common.enums.BusinessType;
import com.entmanage.common.utils.poi.ExcelUtil;
import com.entmanage.common.core.page.TableDataInfo;

/**
 * 实习生信息Controller
 *
 * @author lsq
 * @date 2025-07-31
 */
@Api(tags = {"collegeco-HrmIntern模块"}, description = "实习生信息")
@RestController
@RequestMapping("/collegeco/intern")
public class CollegecoInternController extends BaseController
{
    @Autowired
    private ICollegecoInternService hrmInternService;

    /**
     * 查询实习生信息列表
     */
    @PreAuthorize("@ss.hasPermi('collegeco:intern:list')")
    @GetMapping("/list")
    public TableDataInfo list(CollegecoIntern hrmIntern)
    {
        startPage();
        List<CollegecoIntern> list = hrmInternService.selectHrmInternList(hrmIntern);
        return getDataTable(list);
    }

    /**
     * 导出实习生信息列表
     */
    @PreAuthorize("@ss.hasPermi('collegeco:intern:export')")
    @Log(title = "实习生信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CollegecoIntern hrmIntern)
    {
        List<CollegecoIntern> list = hrmInternService.selectHrmInternList(hrmIntern);
        ExcelUtil<CollegecoIntern> util = new ExcelUtil<CollegecoIntern>(CollegecoIntern.class);
        util.exportExcel(response, list, "实习生信息数据");
    }

    /**
     * 获取实习生信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('collegeco:intern:query')")
    @GetMapping(value = "/{internId}")
    public AjaxResult getInfo(@PathVariable("internId") Long internId)
    {
        return success(hrmInternService.selectHrmInternByInternId(internId));
    }

    /**
     * 新增实习生信息
     */
    @PreAuthorize("@ss.hasPermi('collegeco:intern:add')")
    @Log(title = "实习生信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CollegecoIntern hrmIntern)
    {
        return toAjax(hrmInternService.insertHrmIntern(hrmIntern));
    }

    /**
     * 修改实习生信息
     */
    @PreAuthorize("@ss.hasPermi('collegeco:intern:edit')")
    @Log(title = "实习生信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CollegecoIntern hrmIntern)
    {
        return toAjax(hrmInternService.updateHrmIntern(hrmIntern));
    }

    /**
     * 删除实习生信息
     */
    @PreAuthorize("@ss.hasPermi('collegeco:intern:remove')")
    @Log(title = "实习生信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{internIds}")
    public AjaxResult remove(@PathVariable Long[] internIds)
    {
        return toAjax(hrmInternService.deleteHrmInternByInternIds(internIds));
    }
}
